package com.zzf.构建者模式;

public class A {

    public static class Builder{
        private String id;
        private String name;
        private int num;
        private String info;

        public Builder(String id,String name){
            this.id = id;
            this.name = name;
        }

        public Builder setNum(int num){
            this.num = num;
            return this;
        }

        public Builder setInfo(String info) {
            this.info = info;
            return this;
        }

        public A build(){
            return new A(this);
        }
    }

    private String id;
    private String name;
    private int num;
    private String info;

    private A(Builder builder){
        this.id = builder.id;
        this.name = builder.name;
        this.num = builder.num;
        this.info = builder.info;
    }

    public String show(){
        return this.id+","+this.name+","+this.num+","+this.info;
    }
}
